package org.visionlibrary.image.colormodel;

import java.awt.Point;
import java.awt.color.ColorSpace;
import java.awt.image.ColorModel;

import javax.media.jai.TiledImage;

public class XYZConverter implements ColorConverter {

	@Override
	public float[] convert(TiledImage src, Point pixel) {
		return this.convert(src, pixel.x, pixel.y);
	}

	@Override
	public float[] convert(TiledImage src, int pixelx, int pixely) {
		float[] values = new float[src.getNumBands()];
		for(int i=0; i < src.getNumBands(); i++)
			values[i] = src.getSampleFloat(pixelx, pixely, i);
		
		return convert(src.getColorModel(), values);
	}

	@Override
	public float[] convert(ColorModel cm, float[] values) {
		return convert(cm.getColorSpace(), values);
	}

	@Override
	public float[] convert(ColorSpace cs, float[] values) {
		switch(cs.getType()) {
		case ColorSpace.TYPE_RGB: {
				return convertFromTYPE_RGB(values);
			}
		
		default:
			return null;
		}
	}
	
	public float[] convertFromTYPE_RGB(float[] values) {
		
		return null;
	}
}
